bitkeeper revision 1.1159.1.288 (417fa37aiUr7WWjaJDqszVX8RYOFGA)
authorkaf24@freefall.cl.cam.ac.uk <kaf24@freefall.cl.cam.ac.uk>
Wed, 27 Oct 2004 13:32:42 +0000 (13:32 +0000)
committerkaf24@freefall.cl.cam.ac.uk <kaf24@freefall.cl.cam.ac.uk>
Wed, 27 Oct 2004 13:32:42 +0000 (13:32 +0000)
Tiny bug fixes and cleanups.

tools/libxc/xc_linux_build.c
xen/common/dom0_ops.c
xen/common/domain.c

index 8362fd1b70f5f866580173d1ff890bd79c3f1831..cc4c0f4561435b910db89a0e121023c45f5a6840 100644 (file)
@@ -522,7 +522,7 @@ int xc_linux_build(int xc_handle,
     ctxt->cpu_ctxt.ss = FLAT_GUESTOS_DS;
     ctxt->cpu_ctxt.cs = FLAT_GUESTOS_CS;
     ctxt->cpu_ctxt.eip = vkern_entry;
-    ctxt->cpu_ctxt.esp = vstartinfo_start;
+    ctxt->cpu_ctxt.esp = vstartinfo_start + 2*PAGE_SIZE;
     ctxt->cpu_ctxt.esi = vstartinfo_start;
     ctxt->cpu_ctxt.eflags = (1<<9) | (1<<2);
 
@@ -545,7 +545,7 @@ int xc_linux_build(int xc_handle,
 
     /* Ring 1 stack is the initial stack. */
     ctxt->guestos_ss  = FLAT_GUESTOS_DS;
-    ctxt->guestos_esp = vstartinfo_start;
+    ctxt->guestos_esp = vstartinfo_start + 2*PAGE_SIZE;
 
     /* No debugging. */
     memset(ctxt->debugreg, 0, sizeof(ctxt->debugreg));
index 75de00b69d114228d674c83e81e17d99e5954d1c..f949c7d7af9730d19ce50c4e74775e7d27091cf7 100644 (file)
@@ -100,14 +100,10 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
         return -EPERM;
 
     if ( copy_from_user(op, u_dom0_op, sizeof(*op)) )
-    {
         return -EFAULT;
-    }
 
     if ( op->interface_version != DOM0_INTERFACE_VERSION )
-    {
         return -EACCES;
-    }
 
     TRACE_5D(TRC_DOM0OP_ENTER_BASE + op->cmd, 
              0, op->u.dummy[0], op->u.dummy[1], 
@@ -164,9 +160,9 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
 
     case DOM0_CREATEDOMAIN:
     {
-        struct domain    *d;
-        unsigned int      pro;
-        domid_t           dom;
+        struct domain *d;
+        unsigned int   pro = 0;
+        domid_t        dom;
 
         dom = op->u.createdomain.domain;
         if ( (dom > 0) && (dom < DOMID_FIRST_RESERVED) )
@@ -179,29 +175,20 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
             break;
 
         if ( op->u.createdomain.cpu == -1 )
-       {
-           /* Do an initial placement. Fix me for hyperthreading! */
-           struct domain    *d;
-           int i, j=0, c[smp_num_cpus];
-           
-           pro=0; /* keep compiler happy */
-
-           for (i=0;i<smp_num_cpus;i++) 
-               c[i]=0;
-
-           for_each_domain ( d ) {
-               c[d->processor]++;
-               j++;
-           }
-
-           for (i=0;i<smp_num_cpus;i++) {
-               if( c[i]<j )
-               {
-                   j = c[i];
-                   pro = i;
-               }
-           }
-       }
+        {
+            /* Do an initial placement. Pick the least-populated CPU. */
+            struct domain *d;
+            unsigned int i, cnt[NR_CPUS] = { 0 };
+
+            read_lock_irq(&tasklist_lock);
+            for_each_domain ( d )
+                cnt[d->processor]++;
+            read_unlock_irq(&tasklist_lock);
+
+            for ( i = 0; i < smp_num_cpus; i++ )
+                if ( cnt[i] < cnt[pro] )
+                    pro = i;
+        }
         else
             pro = op->u.createdomain.cpu % smp_num_cpus;
 
@@ -624,9 +611,9 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
                         break;
                     }
 
-                   if ( page->u.inuse.type_info & PGT_pinned )
-                       type |= LPINTAB;
-                   l_arr[j] |= type;
+                    if ( page->u.inuse.type_info & PGT_pinned )
+                        type |= LPINTAB;
+                    l_arr[j] |= type;
                     put_page(page);
                 }
                 else
@@ -657,7 +644,7 @@ long do_dom0_op(dom0_op_t *u_dom0_op)
         d = find_domain_by_id( op->u.setdomainmaxmem.domain );
         if ( d != NULL )
         {
-           vm_assist(d, op->u.setdomainvmassist.cmd,
+            vm_assist(d, op->u.setdomainvmassist.cmd,
                       op->u.setdomainvmassist.type);
             put_domain(d);
             ret = 0;
index 57e965c3ad1e267384eb761ab2031feee1f5b422..cbbd29c0cb2bea482dbf326f7981cccfa00b2e8d 100644 (file)
@@ -168,12 +168,12 @@ void domain_shutdown(u8 reason)
 
         if ( reason == 0 ) 
         {
-            printk("Domain 0 halted: Our work here is done.\n");
+            printk("Domain 0 halted: halting machine.\n");
             machine_halt();
         }
         else
         {
-            printk("Domain 0 shutdown: rebooting machine!\n");
+            printk("Domain 0 shutdown: rebooting machine.\n");
             machine_restart(0);
         }
     }
@@ -207,15 +207,6 @@ unsigned int alloc_new_dom_mem(struct domain *d, unsigned int kbytes)
 
         /* initialise to machine_to_phys_mapping table to likely pfn */
         machine_to_phys_mapping[page-frame_table] = alloc_pfns;
-
-#ifndef NDEBUG
-        {
-            /* Initialise with magic marker if in DEBUG mode. */
-            void *a = map_domain_mem((page-frame_table)<<PAGE_SHIFT);
-            memset(a, 0x80 | (char)d->id, PAGE_SIZE);
-            unmap_domain_mem(a);
-        }
-#endif
     }
 
     return 0;